function queryForm(pageIndex,pageSize)
{
     var url =base+"/reportMain/pagingInfo.do?pageIndex="+pageIndex+"&pageSize="+pageSize;
     var params =jQuery("#queryForm").serialize();
     params=decodeURIComponent(params,true); 
     jQuery("#reportContent").load(url+"&"+ encodeURI(encodeURI(params)),statisticsCommonBet);
}


function statisticsCommonBet()
{ 
	 jQuery("#commBetSummary").remove();
	  var rechargeTb = jQuery("#reportContentTb").children().length;
	  if(rechargeTb>0)
	  {
	  var params =jQuery("#queryForm").children().not("input[name='repCode']").serialize();
	  params=decodeURIComponent(params,true); 
	  jQuery.post(
	            base+"/reportMain/queryRepSummary.do?repCode=statisticsCommonBetSummary&"+ encodeURI(encodeURI(params)), 
	            function(result){
	            	var data=eval("("+result+")");
	                var tr = jQuery("<tr style='height:22px;' id='commBetSummary'/>");
	                jQuery("<td bgcolor='#FFFFFF' class='STYLE2' colspan='9'><div align='center' class='STYLE2 STYLE1'>汇总记录:</div></td>").appendTo(tr);
	                jQuery("<td bgcolor='#FFFFFF' class='STYLE2 STYLE1' align='center'>"+data.betsAmount.toFixed(2)+"</div></td>").appendTo(tr); 
	                jQuery("<td bgcolor='#FFFFFF' class='STYLE2 STYLE1' align='center'>"+data.betsBonus.toFixed(2)+"</div></td>").appendTo(tr); 
	                jQuery("<td bgcolor='#FFFFFF' class='STYLE2 STYLE1' align='center'>"+data.betsFanDian.toFixed(2)+"</div></td>").appendTo(tr); 
	                jQuery("<td bgcolor='#FFFFFF' class='STYLE2' align='center'>----</td>").appendTo(tr);
	                jQuery("<td bgcolor='#FFFFFF' class='STYLE2' align='center'>----</td>").appendTo(tr);
                  jQuery(tr).appendTo("#reportContentTb");
	            });

	  }
}


function gotoPage(pageSize)
{
   var pageIndex =jQuery("#pageIndex").val();
   queryForm(pageIndex,pageSize);
}

 


jQuery(function()
  {
   var handlerurl =base+"/reportMain/getRepResult.do?repCode=getRepResultInfo";
   $.ajax({
    type: "POST",
    url: handlerurl,   
    success: function(data){ 
            var data=eval("("+data+")");
            jQuery(data).each(function(index,obj)
             {
               jQuery("<option value='"+obj.id+"'>"+obj.lotteryName+"</option>").appendTo("#lotteryType");
             }
              );
          } 
       }
   ); 
   var startDateStr =DateUtil.dateToStr('yyyy-MM-dd');
   jQuery("#queryForm input[name='startDate']").val(startDateStr+" 00:00:00");
   queryForm(1,15);
  }
  );

//删除普通投注记录
function delCommBet(betId)
{
	 if(window.confirm("确定要删除该用户的投注记录?"))
	 {
		  var delCommBetUrl = base+"/commBet/deleteCommBet.do";
		  $.ajax({
			    type: "POST",
			    url: delCommBetUrl,
			    data:{id:betId},
			    success: function(data){ 
			             var data=eval("("+data+")");
			             if(data.STATUS==0)
			             {
			            	 alert("删除成功!");
			            	 queryForm(1, 15);
			             }
			             else
			             {
			            	 alert(data.MSG);
			             }
			          } 
			       }
			   ); 
     }
}



function showBetsDetail(id)
{
    var url=base+"/commBet/betsDetail.do?id="+id;
    jQuery.layer({
        type: 2, 
        border: [0], 
        shadeClose: true,
        closeBtn: true,
        title: false,
        shadeClose: true,
        closeBtn: true,
        iframe: {src : url},
        area: ['620px' , '418px'] 
       }); 
}
